package com.iteasy.manage.exception;

import lombok.Data;

@Data
public class BizException extends RuntimeException {

    private String code;

    private String message;

    @Override
    public String getMessage() {
        return super.getMessage();
    }

    public BizException(String code,String message) {
        this.code = code;
        this.message = message;
    }

    public static BizException build(String code, String message) {
        return new BizException(code,message);
    }

    public static BizException fail(String message) {
        return new BizException("100002", message);
    }

    public static BizException fail() {
        return new BizException("100000","操作失败");
    }

    public static BizException error() {
        return new BizException("999999","系统异常");
    }

    public static BizException success() {
        return new BizException("0000000","操作成功");
    }

}
